package com.dx.mes.common.dao.impl;

import com.dx.common.table.ppt.Ret_prd_info;
import com.dx.mes.common.core.dao.impl.GenericHibernateDao;
import com.dx.mes.common.dao.IRetPrdInfoDao;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class RetPrdInfoHibernateDao extends GenericHibernateDao<Ret_prd_info, String> implements IRetPrdInfoDao {
	public List<Ret_prd_info> getShtListInfo(String boxId) {
		List<Ret_prd_info> prdInfoList = new ArrayList<Ret_prd_info>();
		String querySql = "FROM Ret_prd_info where box_id_fk ='" + boxId + "'";
		prdInfoList = this.find(querySql);
		if (prdInfoList.isEmpty()) {
			return null;
		}
		return prdInfoList;
	}
	public List<Ret_prd_info> getShtListInfoWithLock(String boxId) {
		List<Ret_prd_info> prdInfoList = new ArrayList<Ret_prd_info>();
		String hql = "FROM Ret_prd_info where box_id_fk = ?";
		prdInfoList = this.listWithLock(hql, boxId);
		if (prdInfoList.isEmpty()) {
			return null;
		}
		return prdInfoList;
	}
	
	public List<Ret_prd_info> getShtListInfoWithLockByPrdIds(String prdIds) {
		List<Ret_prd_info> prdInfoList = new ArrayList<Ret_prd_info>();
		String hql = "FROM Ret_prd_info where prd_seq_id in ( ? )";
		prdInfoList = this.listWithLock(hql, prdIds);
		if (prdInfoList.isEmpty()) {
			return null;
		}
		return prdInfoList;
	}
	
	public List<Ret_prd_info> getShtListInfoByPrdIds(String prdIds) {
		List<Ret_prd_info> prdInfoList = new ArrayList<Ret_prd_info>();
		String querySql = "FROM Ret_prd_info where prd_seq_id in(" + prdIds + ")";
		prdInfoList = this.find(querySql);
		if (prdInfoList.isEmpty()) {
			return null;
		}
		return prdInfoList;
	}
	@Override
	public Boolean isChangeProcFlg(Ret_prd_info retPrdInfo) {
		// TODO Auto-generated method stub
		return null;
	}
}
